﻿/// <reference path="../../../extjs/ext-all-debug.js" />
Ext.define('yzmh.view.collect.Bengou', {
    extend: 'Ext.Panel',
    alias: 'widget.bengou',
    closable: true,
    title: '',
    layout: 'border',
    tbar: [
        {
            xtype: 'combo',
            name: 'contentfolder',
            fieldLabel:'类型',
            typeAhead: true,
            displayField: 'name',
            store: Ext.create("Ext.data.ArrayStore", {
                fields: ['name'],
                data: [['全部'], ['少女爱情'], ['少年热血'], ['侦探推理'], ['恐怖灵异'], ['武侠格斗'],[ '爆笑喜剧'], ['科幻魔幻'], ['竞技体育'], ['耽美BL'],['励志职场'],['战争历史'],['生活亲情']]
            }),
            labelWidth: 50,
            labelAlign: 'right',
            width:150,
            forceSelection: true,
            editable: false,
            queryMode: 'local'
        },
        {
            xtype: 'combo',
            name: 'letterfolder',
            fieldLabel: '字母',
            typeAhead: true,
            displayField: 'name',
            store: Ext.create("Ext.data.ArrayStore", {
                fields: ['name'],
                data: [['全部'], ['A'], ['B'], ['C'], ['D'], ['E'], ['F'], ['G'], ['H'], ['I'], ['J'], ['K'], ['L'], ['M'], ['N'], ['O'], ['P'], ['Q'], ['R'], ['S'], ['T'], ['U'], ['V'], ['W'], ['X'], ['Y'], ['Z'], ['0~9']]
            }),
            labelWidth: 50,
            labelAlign: 'right',
            width: 120,
            forceSelection: true,
            editable: false,
            queryMode: 'local'
        },
        {
            xtype: 'combo',
            name: 'areafolder',
            fieldLabel: '地区',
            typeAhead: true,
            displayField: 'name',
            store: Ext.create("Ext.data.ArrayStore", {
                fields: ['name'],
                data: [['全部'], ['内地'], ['日本'], ['欧美'], ['港台'], ['其它']]
            }),
            labelWidth: 50,
            labelAlign: 'right',
            width: 120,
            forceSelection: true,
            editable: false,
            queryMode: 'local'
        },
        {
            xtype: 'combo',
            name: 'state',
            fieldLabel: '状态',
            typeAhead: true,
            displayField: 'name',
            valueField:'value',
            store: Ext.create("Ext.data.ArrayStore", {
                fields: ['name','value'],
                data: [['全部', 2], ['连载', 0], ['完结', 1]]
            }),
            labelWidth: 50,
            labelAlign: 'right',
            width: 120,
            forceSelection: true,
            editable: false,
            queryMode: 'local'
        },
        { xtype: 'tbfill' }, { action: 'checkComic', text: '检测漫画', icon: 'extjs/icons/book_link.png' }, "-", { action: 'importComic', text: '导入漫画', icon: 'extjs/icons/book_add.png' }, "-", { action: 'importChapter', text: '导入章节', icon: 'extjs/icons/page_add.png' }
    ],
    items: [{
        xtype: 'grid',
        store: 'collect.Bengou',
        loadMask: true,
        columnLines: true,
        forceFit: true,
        region: 'center',
        sortableColumns: false,
        viewConfig: {
            trackOver: false,
            stripeRows: true
        },
        selType: 'rowmodel',
        selModel: Ext.create("Ext.selection.RowModel", {
            mode: 'SINGLE'
        }),
        columns: [{
                xtype: 'rownumberer',
                align: 'center'
            },
            { header: '漫画名称', dataIndex: 'mhmc' },
            { header: '作者', dataIndex: 'zzmc', width: 50 },
            {
                header: '状态', dataIndex: 'zt', width: 20
            },
            {
                header: '漫画地址', dataIndex: 'mhurl', width: 160
            },
            { header: '章节名称', dataIndex: 'zjmc', width: 50 },
            { header: '更新时间', dataIndex: 'date', align: 'center', width: 50 },
            {
                action: 'view',
                xtype: 'actioncolumn',
                width: 20,
                header: '预览',
                align: 'center',
                icon: 'extjs/icons/page_link.png'
            },
            {
                header: '存在',
                width: 20,
                align: 'center',
                dataIndex: 'exist',
                xtype: 'booleancolumn',
                trueText: '是',
                falseText: '否'
            }
        ],
        bbar: {
            xtype: 'pagingtoolbar',
            store: 'collect.Bengou',
            displayInfo: true,
            displayMsg: '显示数据 {0} - {1} of {2}',
            emptyMsg: "没有查询到数据"
        }
    }, {
        xtype: 'panel',
        layout: 'vbox',
        region: 'east',
        border: false,
        hidden:true,
        items: [{
            xtype: 'propertygrid',
            width: 300,
            source: { }
        }, {
            name: 'chaptergrid',
            xtype: 'grid',
            width: 300,
            flex: 1,
            columnLines: true,
            forceFit: true,
            store: {
                stype: 'store',
                model: 'yzmh.model.Chapter',
                groupField: 'type'
            },
            selType: 'rowmodel',
            selModel: Ext.create("Ext.selection.RowModel", {
                mode: 'MULTI'
            }),
            features:[Ext.create('Ext.grid.feature.Grouping', {
                groupHeaderTpl: '{name} ({rows.length} 条记录)',
                hideGroupedHeader: true,
                startCollapsed: false,
                id: 'bengouGrouping'
            })],
            columns: [
                { header: '名称', dataIndex: 'zjmc', width: 50 },
                {
                    header: '地址', dataIndex: 'zjurl'
                }]
            }]
        }]
});

